﻿#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using Ease.EaseNode.Runtime;
using UnityEditor.Experimental.GraphView;

namespace Ease.EaseMission.Runtime
{
    public partial class MissionStep
    {
        public override string Key => Id.ToString();

        protected override void OnNodeInfoInit()
        {
            NodeInfo.InputConfigs.Clear();
            NodeInfo.InputConfigs.Add(new PortConfig() { id = 0, capacity = Port.Capacity.Single, portName = "input" });
            NodeInfo.OutputConfigs.Clear();
            NodeInfo.OutputConfigs.Add(new PortConfig() { id = 0, capacity = Port.Capacity.Single, portName = "output" });
        }

        protected override void OnNodeInfoChange()
        {
        }
        private CommonNodeDataManager<MissionData> _helper;

        public INodeDataManager NodeDataManager
        {
            get
            {
                if (_helper == null)
                {
                    _helper = new CommonNodeDataManager<MissionData>(datas, new List<Type> { typeof(MissionData) });
                    _helper.OnDataCreateEvent += (a) => { a.Id = id * 1000 + datas.Count; };
                }

                return _helper;
            }
        }
    }
}
#endif